package com.gsy.nauDemo;

import com.gsy.gsy_common_util.fileUtil.FileUtils;

import java.io.IOException;
import java.util.ArrayList;

public class Demo {
    public static void main(String[] args) {
        String []title = new String[]{"title1","title2"};
        ArrayList<Data> arrayList = new ArrayList<>();
        StringBuffer stringBuffer = new StringBuffer();
        for (int i = 0; i < 10; i++) {
            arrayList.add(new Data("0123123","123jksdhasd"));

        }
        for (int i = 0; i < title.length; i++) {
            stringBuffer.append(title[i]);
            stringBuffer.append(",");
        }
        stringBuffer.deleteCharAt(stringBuffer.length()-1);
        stringBuffer.append("\n");
        for (Data data : arrayList) {
            stringBuffer.append(data.toString());
            stringBuffer.append("\n");
        }
        try {
            FileUtils.stringToFile(stringBuffer.toString(),"","tt.csv","utf-8");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
